var e, t = require("../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../@babel/runtime/regenerator")), a = require("../../../@babel/runtime/helpers/asyncToGenerator"), n = require("../../../utils/DPagination").default, o = require("../common"), r = o.getProjectNameLang, i = o.getLocation, s = getApp(), c = s.getNetAddresss("plugin.store-projects.frontend.project.get-list"), u = new n("projects"), l = null;

Page({
    data: {
        projects: {},
        projectName: "",
        projectNameLang: r()
    },
    onLoad: (e = a(t.default.mark(function e(a) {
        return t.default.wrap(function(e) {
            for (;;) switch (e.prev = e.next) {
              case 0:
                return u.bind(this), e.next = 3, i();

              case 3:
                l = e.sent, this.getProjects(), wx.setNavigationBarTitle({
                    title: "搜索" + r()
                });

              case 6:
              case "end":
                return e.stop();
            }
        }, e, this);
    })), function(t) {
        return e.apply(this, arguments);
    }),
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.getProjects();
    },
    onShareAppMessage: function() {},
    projectNameInputChanged: function(e) {
        var t = e.detail;
        this.setData({
            projectName: t
        });
    },
    clearInputProjectName: function() {
        this.setData({
            projectName: ""
        }), this.searchProject();
    },
    searchProject: function() {
        u.clean(), this.getProjects();
    },
    getProjects: function() {
        if (!u.finished && !u.loading) {
            wx.showLoading(), u.loading = !0;
            var e = s.qqMapTransBMap(parseFloat(l.point.lng), parseFloat(l.point.lat));
            s._getNetWork({
                url: c,
                data: {
                    lng: e.lng,
                    lat: e.lat,
                    name: this.data.projectName,
                    page: u.loadPage
                },
                success: function(e) {
                    var t = e.data, a = t.data, n = t.result, o = t.msg;
                    u.loading = !1, wx.hideLoading(), 0 !== n ? ((a.current_page == a.last_page || a.data.length < a.per_page) && (u.finished = !0), 
                    u.push(a.data)) : wx.showToast({
                        title: o,
                        icon: "none"
                    });
                }
            });
        }
    }
});